//
//  PayScrollView.m
//  FruitVIP
//
//  Created by 孙艳玲 on 15/7/9.
//  Copyright (c) 2015年 孙艳玲. All rights reserved.
//

#import "PayScrollView.h"

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@implementation PayScrollView

- (instancetype)initWithFrame:(CGRect)frame :(NSString *)moneyText
{
    self = [super initWithFrame:frame];
    if (self) {
        [self getUI:moneyText];
    }
    return self;
}

- (void)getUI:(NSString *)moneyText
{
    UILabel *orderNumbel = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, SCREEN_WIDTH/4, SCREEN_WIDTH/15)];
    orderNumbel.text = @"订单编号";
    orderNumbel.font = [UIFont systemFontOfSize:15];
//        orderNumbel.backgroundColor = [UIColor yellowColor];
    [self addSubview:orderNumbel];
    
    UILabel *orderNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2 - 20, orderNumbel.frame.origin.y, SCREEN_WIDTH /2 , orderNumbel.frame.size.height)];
    orderNumberLabel.text = @"87305749";
    orderNumberLabel.font = [UIFont systemFontOfSize:15];
    orderNumberLabel.textAlignment = NSTextAlignmentRight;
//        orderNumberLabel.backgroundColor = [UIColor redColor];
    [self addSubview:orderNumberLabel];
    
    UILabel *orderLine = [[UILabel alloc] initWithFrame:CGRectMake(20, orderNumbel.frame.origin.y + orderNumbel.frame.size.height + 15, SCREEN_WIDTH - 40, 1)];
    orderLine.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1];
    [self addSubview:orderLine];
    
    
    UILabel *payTime = [[UILabel alloc] initWithFrame:CGRectMake(orderLine.frame.origin.x, orderLine.frame.origin.y +orderLine.frame.size.height + 5, orderNumbel.frame.size.width, orderNumbel.frame.size.height)];
    payTime.text = @"下单时间:";
//    payTime.textColor = [UIColor lightGrayColor];
    payTime.font = [UIFont systemFontOfSize:15];
    [self addSubview:payTime];
    
    UILabel *payTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(orderNumberLabel.frame.origin.x, payTime.frame.origin.y, orderNumberLabel.frame.size.width, payTime.frame.size.height)];
    payTimeLabel.text = @"2015-04-09 11:11:11";
//    payTimeLabel.textColor = [UIColor lightGrayColor];
    payTimeLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:payTimeLabel];

    UILabel *payLine = [[UILabel alloc] initWithFrame:CGRectMake(payTime.frame.origin.x,payTime.frame.origin.y + payTime.frame.size.height + 15 , SCREEN_WIDTH - 40, 1)];
    payLine.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1];
    [self addSubview:payLine];
    
    UILabel *justPay = [[UILabel alloc] initWithFrame:CGRectMake(20, payLine.frame.origin.y + payLine.frame.size.height + 15, SCREEN_WIDTH - 40, payTime.frame.size.height)];
    justPay.text = @"当前支付方式";
    [self addSubview:justPay];
    
    UIImageView *payImageView = [[UIImageView alloc] initWithFrame:CGRectMake(justPay.frame.origin.x, justPay.frame.origin.y + justPay.frame.size.height + 10, SCREEN_WIDTH/6, SCREEN_WIDTH/6)];
//    payImageView.backgroundColor = [UIColor yellowColor];
    UIImage *payImage = [UIImage imageNamed:@"wechart.png"];
    payImageView.image = payImage;
    [self addSubview:payImageView];
    
    UILabel *payLabel = [[UILabel alloc] initWithFrame:CGRectMake(payImageView.frame.origin.x + payImageView.frame.size.width + 40, payImageView.frame.origin.y, SCREEN_WIDTH/2, payImageView.frame.size.height/2)];
 payLabel.text = @"微信支付";
    payLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:payLabel];
    
    UILabel *detailPayLabel = [[UILabel alloc] initWithFrame:CGRectMake(payLabel.frame.origin.x, payLabel.frame.origin.y + payLabel.frame.size.height + 5, payLabel.frame.size.width, payImageView.frame.size.height/3)];
    detailPayLabel.text = @"推荐微信用户支付";
    detailPayLabel.font = [UIFont systemFontOfSize:13];
    detailPayLabel.textColor = [UIColor lightGrayColor];
    [self addSubview:detailPayLabel];
    
    UILabel *justLine = [[UILabel alloc] initWithFrame:CGRectMake(20, payImageView.frame.origin.y + payImageView.frame.size.height + 10, SCREEN_WIDTH - 40, 1)];
    justLine.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1];
    [self addSubview:justLine];
    
    UILabel *goodsMoney = [[UILabel alloc] initWithFrame:CGRectMake(20, justLine.frame.origin.y + justLine.frame.size.height + 5, SCREEN_WIDTH/4, justPay.frame.size.height)];
    goodsMoney.text = @"商品金额:";
    goodsMoney.font = [UIFont systemFontOfSize:15];
    [self addSubview:goodsMoney];
    
    UILabel *goodsMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(goodsMoney.frame.origin.x + goodsMoney.frame.size.width, goodsMoney.frame.origin.y, SCREEN_WIDTH - 40 - goodsMoney.frame.size.width, goodsMoney.frame.size.height)];
    NSString *str = @"￥";
    goodsMoneyLabel.text = moneyText;
    //!!!!!!!!!!!!!!!!
//    goodsMoneyLabel.text = [str stringByAppendingString:goodsMoneyLabel.text];
    goodsMoneyLabel.text = @"50";
    goodsMoneyLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:goodsMoneyLabel];
    
    
    UILabel *shouldPay = [[UILabel alloc] initWithFrame:CGRectMake(goodsMoney.frame.origin.x, goodsMoney.frame.origin.y + goodsMoney.frame.size.height + 3,goodsMoney.frame.size.width, goodsMoney.frame.size.height)];
    shouldPay.text = @"应付金额";
    shouldPay.font =[UIFont systemFontOfSize:15];
    [self addSubview:shouldPay];
    
    UILabel *shouldPayLabel = [[UILabel alloc] initWithFrame:CGRectMake(goodsMoneyLabel.frame.origin.x, shouldPay.frame.origin.y, goodsMoneyLabel.frame.size.width, goodsMoneyLabel.frame.size.height)];
//    shouldPayLabel.text = moneyText;
    shouldPayLabel.text = @"90";
    shouldPayLabel.text = [str stringByAppendingString:shouldPayLabel.text];
    shouldPayLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:shouldPayLabel];
    
    

    UIImageView *takeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, shouldPay.frame.origin.y + shouldPay.frame.size.height + 20, SCREEN_WIDTH - 40 , SCREEN_WIDTH/2)];
//    takeImageView.backgroundColor = [UIColor greenColor];
    takeImageView.contentMode = UIViewContentModeScaleAspectFit;
    UIImage *takeImage = [UIImage imageNamed:@"takeTime.jpg"];
    takeImageView.image = takeImage;
    [self addSubview:takeImageView];
    
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
